<template>
  <Dialog
    :title="dialogTitle"
    v-model="dialogVisible"
    :width="dialogWidth"
    :style="{ maxHeight: '90vh', overflow: 'auto' }"
    class="adaptive-dialog"
  >
    <el-form
      ref="formRef"
      :model="formData"
      :rules="formRules"
      label-width="140px"
      label-position="top"
      v-loading="formLoading"
    >
      <el-row :gutter="20">
        <el-col :span="16">
          <el-form-item label="客户名称" prop="customerId">
            <el-select
              v-model="formData.customerId"
              :disabled="formData.customerDefault"
              class="w-1/1"
              filterable
              placeholder="请选择客户"
              @change="handleCustomerChange(formData.customerId)"
            >
              <el-option
                v-for="item in customerList"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="统计月份" prop="date">
            <el-date-picker
              v-model="formData.date"
              type="month"
              value-format="x"
              placeholder="选择统计月份"
            />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <el-col :span="8">
          <el-form-item label="运营经理" prop="operationManager">
            <el-select v-model="formData.operationManager" class="w-1/1" filterable disabled>
              <el-option
                v-for="item in userOptions"
                :key="item.id"
                :label="item.nickname"
                :value="item.id"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="营业状态" prop="businessStatus">
            <el-select v-model="formData.businessStatus" placeholder="请选择营业状态" disabled>
              <el-option
                v-for="dict in getIntDictOptions(DICT_TYPE.CRM_BUSINESS_STATUS)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="细分行业" prop="industryCategory">
            <el-select v-model="formData.industryCategory" placeholder="请选择细分行业" disabled>
              <el-option
                v-for="dict in getIntDictOptions(DICT_TYPE.CRM_INDUSTRY_CATEGORY)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <el-divider content-position="left"
        >经营数据（单位：万元）（所有欠费数据统计截至统计月份的次月1日）</el-divider
      >
      <!-- el-row 容器增加禁止换行样式 -->
      <el-row :gutter="10" class="no-wrap-row">
        <el-col :span="2">
          <el-form-item label="设备抵押情况" prop="mortgageEquipmentSituation" class="mb-0px!">
            <el-select
              v-model="formData.mortgageEquipmentSituation"
              placeholder="请选择设备抵押情况"
            >
              <el-option
                v-for="dict in getIntDictOptions(DICT_TYPE.CRM_MORTGAGE_EQUIPMENT_SITUATION)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item
            label="设备抵押估值（万元）"
            prop="equipmentMortgageValuation"
            class="mb-0px!"
          >
            <el-input
              type="number"
              v-model="formData.equipmentMortgageValuation"
              placeholder="请输入设备抵押估值（万元）"
              v-show="
                getDictLabel(
                  DICT_TYPE.CRM_MORTGAGE_EQUIPMENT_SITUATION,
                  formData.mortgageEquipmentSituation
                ) == '已抵押设备'
              "
            />
          </el-form-item>
        </el-col>
        <el-col :span="2">
          <el-form-item label="个人担保情况" prop="personalGuaranteeSituation" class="mb-0px!">
            <el-select
              v-model="formData.personalGuaranteeSituation"
              placeholder="请选择个人担保情况"
            >
              <el-option
                v-for="dict in getIntDictOptions(DICT_TYPE.CRM_PERSONAL_GUARANTEE_SITUATION)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="租金配套欠费（万元）" prop="rent" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.rent"
              placeholder="请输入租金配套欠费（万元）"
              @change="onChangeFees(formData)"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="供应链欠费（万元）" prop="supplyChain" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.supplyChain"
              placeholder="请输入供应链欠费（万元）"
              @change="onChangeFees(formData)"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="园区总欠费（万元）" prop="allFee" class="mb-0px!">
            <el-input disabled type="number" v-model="formData.allFee" />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="欠薪金额（万元）" prop="backPayAmount" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.backPayAmount"
              placeholder="请输入欠薪金额（万元）"
              @change="onChangeAllDebt(formData)"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="银行贷款（万元）" prop="loan" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.loan"
              placeholder="请输入银行贷款（万元）"
              @change="onChangeAllDebt(formData)"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="其它社会债务（万元）" prop="otherDebts" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.otherDebts"
              placeholder="请输入其它社会债务（万元）"
              @change="onChangeAllDebt(formData)"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="总负债估算（万元）" prop="allDebt" class="mb-0px!">
            <el-input
              disabled
              type="number"
              v-model="formData.allDebt"
              placeholder="请输入总负债估算（万元）"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="产值（万元）" prop="outputAmount" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.outputAmount"
              placeholder="请输入产值（万元）"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="主要客户货款回笼周期（月）" prop="paymentCycle" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.paymentCycle"
              placeholder="请输入主要客户货款回笼周期"
            />
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="其他经营概况描述" prop="otherSituations" class="mb-0px!">
            <el-input v-model="formData.otherSituations" placeholder="请输入其他经营概况描述" />
          </el-form-item>
        </el-col>
      </el-row>

      <el-divider content-position="left">用工情况</el-divider>

      <el-row :gutter="10" class="no-wrap-row">
        <el-col :span="2">
          <el-form-item label="现有员工人数" prop="totalEmp" class="mb-0px!">
            <el-input type="number" v-model="formData.totalEmp" placeholder="请输入现有员工人数" />
          </el-form-item>
        </el-col>
        <el-col :span="2">
          <el-form-item label="缺工人数" prop="shortageEmp" class="mb-0px!">
            <el-input type="number" v-model="formData.shortageEmp" placeholder="请输入缺工人数" />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="是否有集体裁员计划" prop="isLayoffPlan" class="mb-0px!">
            <el-select v-model="formData.isLayoffPlan" placeholder="请选择是否有集体裁员计划">
              <el-option
                v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="2">
          <el-form-item label="计划裁员人数" prop="layoffs" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.layoffs"
              placeholder="请输入计划裁员人数"
              v-show="formData.isLayoffPlan === true"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="是否有降薪计划" prop="isSalaryReductionPlan" class="mb-0px!">
            <el-select v-model="formData.isSalaryReductionPlan" placeholder="请选择是否有降薪计划">
              <el-option
                v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="降薪幅度（%）" prop="salaryReductionRange" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.salaryReductionRange"
              placeholder="请输入降薪幅度（%）"
              v-show="formData.isSalaryReductionPlan === true"
            />
          </el-form-item>
        </el-col>
        <el-col :span="2">
          <el-form-item label="是否欠薪" prop="isBackPay" class="mb-0px!">
            <el-select v-model="formData.isBackPay" placeholder="请选择是否欠薪">
              <el-option
                v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="2">
          <el-form-item label="欠薪月数" prop="backPayDuration" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.backPayDuration"
              placeholder="请输入欠薪月数"
              v-show="formData.isBackPay === true"
            />
          </el-form-item>
        </el-col>
        <el-col :span="2">
          <el-form-item label="欠薪人数" prop="backPay" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.backPay"
              placeholder="请输入欠薪人数"
              v-show="formData.isBackPay === true"
            />
          </el-form-item>
        </el-col>
      </el-row>

      <el-divider content-position="left">生产数据</el-divider>
      <el-row :gutter="10" class="no-wrap-row">
        <el-col :span="3">
          <el-form-item label="出口订单占比（%）" prop="exportOrderRate" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.exportOrderRate"
              placeholder="请输入出口订单占比（%）"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="内销订单占比（%）" prop="domesticOrderRate" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.domesticOrderRate"
              placeholder="请输入内销订单占比（%）"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item label="产能利用率（%）" prop="capacityRate" class="mb-0px!">
            <el-input
              type="number"
              v-model="formData.capacityRate"
              placeholder="请输入产能利用率（%）"
            />
          </el-form-item>
        </el-col>
        <el-col :span="3">
          <el-form-item
            label="当月订单饱和度（%）"
            prop="monthlyOrderSaturationRate"
            class="mb-0px!"
          >
            <el-input
              type="number"
              v-model="formData.monthlyOrderSaturationRate"
              placeholder="请输入当月订单饱和度（%）"
            />
          </el-form-item>
        </el-col>
        <el-col :span="2">
          <el-form-item label="开工天数" prop="workingDays" class="mb-0px!">
            <el-input type="number" v-model="formData.workingDays" placeholder="请输入开工天数" />
          </el-form-item>
        </el-col>
        <el-col :span="2">
          <el-form-item label="开工时数" prop="workingHours" class="mb-0px!">
            <el-input type="number" v-model="formData.workingHours" placeholder="请输入开工时数" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <template #footer>
      <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
      <el-button @click="dialogVisible = false">取 消</el-button>
    </template>
  </Dialog>
</template>
<script setup lang="ts">
import * as CustomerApi from '@/api/crm/customer'
import * as UserApi from '@/api/system/user'
import {
  getBoolDictOptions,
  getIntDictOptions,
  DICT_TYPE,
  getDictObj,
  getDictLabel
} from '@/utils/dict'
import { OperationApi, OperationVO } from '@/api/crm/operation'

/** CRM 运营信息 表单 */
defineOptions({ name: 'OperationForm' })

const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗

const customerList = ref([]) // 客户列表的数据
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中：1）修改时的数据加载；2）提交的按钮禁用
const formType = ref('') // 表单的类型：create - 新增；update - 修改
const formData = ref({
  id: undefined,
  customerId: undefined,
  customerDefault: false,
  date: undefined,
  operationManager: undefined,
  businessStatus: undefined,
  industryCategory: undefined,
  mortgageEquipmentSituation: undefined,
  equipmentMortgageValuation: undefined,
  personalGuaranteeSituation: undefined,
  otherSituations: undefined,
  rent: undefined,
  supplyChain: undefined,
  allFee: undefined,
  backPayAmount: undefined,
  loan: undefined,
  otherDebts: undefined,
  allDebt: undefined,
  outputAmount: undefined,
  paymentCycle: undefined,
  totalEmp: undefined,
  shortageEmp: undefined,
  isLayoffPlan: undefined,
  layoffs: undefined,
  isSalaryReductionPlan: undefined,
  salaryReductionRange: undefined,
  isBackPay: undefined,
  backPayDuration: undefined,
  backPay: undefined,
  exportOrderRate: undefined,
  domesticOrderRate: undefined,
  capacityRate: undefined,
  monthlyOrderSaturationRate: undefined,
  workingDays: undefined,
  workingHours: undefined
})
const formRules = reactive({
  customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
  date: [{ required: true, message: '填报日期不能为空', trigger: 'blur' }],
  operationManager: [{ required: true, message: '运营经理不能为空', trigger: 'blur' }],
  businessStatus: [{ required: true, message: '营业状态不能为空', trigger: 'change' }],
  industryCategory: [{ required: true, message: '行业类别不能为空', trigger: 'change' }],
  mortgageEquipmentSituation: [
    { required: true, message: '设备抵押情况不能为空', trigger: 'change' }
  ],
  equipmentMortgageValuation: [
    { required: true, message: '设备抵押估值不能为空', trigger: 'blur' }
  ],
  personalGuaranteeSituation: [
    { required: true, message: '个人担保情况不能为空', trigger: 'change' }
  ],
  otherSituations: [{ required: true, message: '其他经营概况描述不能为空', trigger: 'blur' }],
  rent: [{ required: true, message: '租金配套欠费不能为空', trigger: 'blur' }],
  supplyChain: [{ required: true, message: '供应链欠费不能为空', trigger: 'blur' }],
  allFee: [{ required: true, message: '总负债估算不能为空', trigger: 'blur' }],
  backPayAmount: [{ required: true, message: '欠薪金额不能为空', trigger: 'blur' }],
  loan: [{ required: true, message: '银行贷款不能为空', trigger: 'blur' }],
  otherDebts: [{ required: true, message: '其它社会债务不能为空', trigger: 'blur' }],
  allDebt: [{ required: true, message: '总负债不能为空', trigger: 'blur' }],
  outputAmount: [{ required: true, message: '产值不能为空', trigger: 'blur' }],
  paymentCycle: [{ required: true, message: '主要客户货款回笼周期不能为空', trigger: 'blur' }],
  totalEmp: [{ required: true, message: '现有员工人数不能为空', trigger: 'blur' }],
  shortageEmp: [{ required: true, message: '缺工人数不能为空', trigger: 'blur' }],
  isLayoffPlan: [{ required: true, message: '是否有集体裁员计划不能为空', trigger: 'change' }],
  layoffs: [{ required: true, message: '裁员人数不能为空', trigger: 'blur' }],
  isSalaryReductionPlan: [{ required: true, message: '是否有降薪计划不能为空', trigger: 'change' }],
  salaryReductionRange: [
    { required: true, message: '降薪幅度（百分比）不能为空', trigger: 'blur' }
  ],
  isBackPay: [{ required: true, message: '是否欠薪不能为空', trigger: 'change' }],
  backPayDuration: [{ required: true, message: '欠薪月数不能为空', trigger: 'blur' }],
  backPay: [{ required: true, message: '欠薪人数不能为空', trigger: 'blur' }],
  exportOrderRate: [{ required: true, message: '出口订单占比不能为空', trigger: 'blur' }],
  domesticOrderRate: [{ required: true, message: '内销订单占比不能为空', trigger: 'blur' }],
  capacityRate: [{ required: true, message: '产能利用率不能为空', trigger: 'blur' }],
  monthlyOrderSaturationRate: [
    { required: true, message: '当月订单饱和度不能为空', trigger: 'blur' }
  ],
  workingDays: [{ required: true, message: '开工天数不能为空', trigger: 'blur' }],
  workingHours: [{ required: true, message: '开工工时数不能为空', trigger: 'blur' }]
})
const formRef = ref() // 表单 Ref
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表

const handleCustomerChange = async (customerId: number) => {
  const customer = customerList.value.find<CustomerApi.CustomerVO>((item) => item.id === customerId)
  if (customer) {
    formData.value.operationManager = customer.ownerUserId
    formData.value.businessStatus = customer.businessStatus
    formData.value.industryCategory = customer.bsType
  }
}

/** 打开弹窗 */
const open = async (type: string, id?: number, customerId?: number) => {
  dialogVisible.value = true
  dialogTitle.value = t('action.' + type)
  formType.value = type
  resetForm()
  if (id || customerId) {
    formLoading.value = true
    try {
      // 修改时，设置数据
      if (id) {
        formData.value = await OperationApi.getOperation(id)
        formData.value.customerDefault = true // 默认客户的选择，不允许变
      } else {
        formData.value.customerId = customerId
        formData.value.customerDefault = true // 默认客户的选择，不允许变
        const res = await CustomerApi.getCustomer(customerId)
        formData.value.operationManager = res.ownerUserId
        formData.value.businessStatus = res.businessStatus
        formData.value.industryCategory = res.bsType
      }
    } finally {
      formLoading.value = false
    }
  }
  // 获得用户列表
  userOptions.value = await UserApi.getSimpleUserList()
  // 获得客户列表
  customerList.value = await CustomerApi.getCustomerSimpleList()
}
defineExpose({ open }) // 提供 open 方法，用于打开弹窗

/** 提交表单 */
const emit = defineEmits(['success']) // 定义 success 事件，用于操作成功后的回调
const submitForm = async () => {
  // 校验表单
  await formRef.value.validate()
  // 提交请求
  formLoading.value = true
  try {
    const data = formData.value as unknown as OperationVO
    if (formType.value === 'create') {
      await OperationApi.createOperation(data)
      message.success(t('common.createSuccess'))
    } else {
      await OperationApi.updateOperation(data)
      message.success(t('common.updateSuccess'))
    }
    dialogVisible.value = false
    // 发送操作成功的事件
    emit('success')
  } finally {
    formLoading.value = false
  }
}

// 监听 mortgageEquipmentSituation 的变化，并动态更新 equipmentMortgageValuation 的校验规则
watch(
  () => formData.value.mortgageEquipmentSituation,
  (newVal) => {
    if (getDictLabel(DICT_TYPE.CRM_MORTGAGE_EQUIPMENT_SITUATION, newVal) == '已抵押设备') {
      // 如果 mortgageEquipmentSituation 为 true，则 equipmentMortgageValuation 必须填写
      formRules.equipmentMortgageValuation = [
        { required: true, message: '设备抵押估值不能为空', trigger: 'blur' }
      ]
    } else {
      // 否则，不需要填写
      formData.value.equipmentMortgageValuation = 0
      formRules.equipmentMortgageValuation = []
    }
  },
  { immediate: true, deep: true }
)

// 监听 isLayoffPlan 的变化，并动态更新 layoffs 的校验规则
watch(
  () => formData.value.isLayoffPlan,
  (newVal) => {
    if (newVal === true) {
      // 如果 isLayoffPlan 为 true，则 layoffs 必须填写
      formRules.layoffs = [{ required: true, message: '裁员人数不能为空', trigger: 'blur' }]
    } else {
      // 否则，不需要填写
      formData.value.layoffs = 0
      formRules.layoffs = []
    }
  },
  { immediate: true, deep: true }
)

// 监听 isSalaryReductionPlan 的变化，并动态更新 salaryReductionRange 的校验规则
watch(
  () => formData.value.isSalaryReductionPlan,
  (newVal) => {
    if (newVal === true) {
      // 如果 isSalaryReductionPlan 为 true，则 salaryReductionRange 必须填写
      formRules.salaryReductionRange = [
        { required: true, message: '降薪幅度（百分比）不能为空', trigger: 'blur' }
      ]
    } else {
      // 否则，不需要填写
      formData.value.salaryReductionRange = 0
      formRules.salaryReductionRange = []
    }
  },
  { immediate: true, deep: true }
)

// 监听 isBackPay 的变化，并动态更新 backPayDuration 的校验规则
watch(
  () => formData.value.isBackPay,
  (newVal) => {
    if (newVal === true) {
      // 如果 isBackPay 为 true，则 backPayDuration 必须填写
      formRules.backPayDuration = [{ required: true, message: '欠薪月数不能为空', trigger: 'blur' }]
      formRules.backPay = [{ required: true, message: '欠薪人数不能为空', trigger: 'blur' }]
    } else {
      // 否则，不需要填写
      formData.value.backPayDuration = 0
      formData.value.backPay = 0
      formRules.backPayDuration = []
      formRules.backPay = []
    }
  },
  { immediate: true, deep: true }
)

/** 处理租金配套欠费和供应链欠费变更 */
const onChangeFees = (row) => {
  row.allFee = row.rent * 1 + row.supplyChain * 1
  onChangeAllDebt(row)
}

/** 处理计算总负债估算 */
const onChangeAllDebt = (row) => {
  row.allDebt = row.allFee * 1 + row.backPayAmount * 1 + row.loan * 1 + row.otherDebts * 1
}

/** 重置表单 */
const resetForm = () => {
  formData.value = {
    id: undefined,
    customerId: undefined,
    customerDefault: false,
    date: undefined,
    operationManager: undefined,
    businessStatus: undefined,
    industryCategory: undefined,
    mortgageEquipmentSituation: undefined,
    equipmentMortgageValuation: undefined,
    personalGuaranteeSituation: undefined,
    otherSituations: undefined,
    rent: undefined,
    supplyChain: undefined,
    allFee: undefined,
    backPayAmount: undefined,
    loan: undefined,
    otherDebts: undefined,
    allDebt: undefined,
    outputAmount: undefined,
    paymentCycle: undefined,
    totalEmp: undefined,
    shortageEmp: undefined,
    isLayoffPlan: undefined,
    layoffs: undefined,
    isSalaryReductionPlan: undefined,
    salaryReductionRange: undefined,
    isBackPay: undefined,
    backPayDuration: undefined,
    backPay: undefined,
    exportOrderRate: undefined,
    domesticOrderRate: undefined,
    capacityRate: undefined,
    monthlyOrderSaturationRate: undefined,
    workingDays: undefined,
    workingHours: undefined
  }
  formRef.value?.resetFields()
}

// 监听窗口变化，动态计算 dialog 宽度
const windowWidth = ref(window.innerWidth)

const dialogWidth = computed(() => {
  if (windowWidth.value <= 768) return '95%' // 手机端
  if (windowWidth.value <= 1024) return '80%' // 平板
  return '90%' // PC 端
})

const handleResize = () => {
  windowWidth.value = window.innerWidth
}

onMounted(() => {
  window.addEventListener('resize', handleResize)
})

onBeforeUnmount(() => {
  window.removeEventListener('resize', handleResize)
})
</script>
<style scoped>
.no-wrap-row {
  display: flex;
  height: 100px; /* 设置你需要的高度 */
  overflow-x: auto; /* 可选：添加横向滚动条 */
  flex-wrap: nowrap; /* 禁止换行 */
}

/* 确保 el-row 不因默认样式导致换行 */
.no-wrap-row .el-row {
  min-width: max-content;
}

.adaptive-dialog .el-dialog__body {
  max-height: 70vh; /* 控制最大高度 */
  padding: 20px;
  overflow-y: auto; /* 内容过多时启用滚动 */
}
</style>
